Allow callers to XendClient.xend_list_domains to specify the detail flag, and
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sat, 4 Mar 2006 18:15:36 +0000 (19:15 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sat, 4 Mar 2006 18:15:36 +0000 (19:15 +0100)
turn detail off when doing vcpu-list.  This avoids calls to xenstore just to
get the list of domains for the vcpu-list call, significantly increasing
performance of that command on loaded systems.

Closes bug #545.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendClient.py
tools/python/xen/xm/main.py

index 920f4fa1844f06545ad4362a0d9834cdf09c8c88..a9ba299cd0cb72fc237b1f7e7b9c6e9b7cff1648 100644 (file)
@@ -196,8 +196,9 @@ class Xend:
     def xend_domains(self):
         return self.xendGet(self.domainurl())
 
-    def xend_list_domains(self):
-        return self.xendGet(self.domainurl(), {'detail': '1'})
+    def xend_list_domains(self, detail = True):
+        return self.xendGet(self.domainurl(),
+                            {'detail': detail and '1' or '0'})
 
     def xend_domain_vcpuinfo(self, dom):
         return self.xendGet(self.domainurl(dom), {'op': 'vcpuinfo'})
index 23d1beeb8bdbeee7e629da4050d5fa058aebe2ab..7eaf798ec8d1387ab3a218e402754e1c903035ee 100644 (file)
@@ -396,10 +396,8 @@ def xm_vcpu_list(args):
     if args:
         dominfo = map(server.xend_domain_vcpuinfo, args)
     else:
-        doms = server.xend_list_domains()
-        dominfo = map(
-            lambda x: server.xend_domain_vcpuinfo(sxp.child_value(x, 'name')),
-            doms)
+        doms = server.xend_list_domains(False)
+        dominfo = map(server.xend_domain_vcpuinfo, doms)
 
     print 'Name                              ID  VCPU  CPU  State  Time(s)  CPU Affinity'